﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="card_add.aspx.cs" Inherits="admin_product_card_add" %>
<script language="javascript" type="text/javascript" src="../../My97DatePicker/WdatePicker.js"></script>
            
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>阳澄湖牌 </title>
    <link href="../main.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">


        function checkForm() {

            var cardPrice = document.getElementById("cardprice");
            var endTime = document.getElementById("endtime");
            var lastTime = document.getElementById("lasttime");
            var cardType = document.getElementById('<%=ddlCardType.ClientID %>');
            var cardCount = document.getElementById("txtCardCount");
            var oBeforNumber = document.getElementById("befornumber");
            if (cardPrice.value == "") {
                alert("礼品卡面值不能为空!")
                cardPrice.focus();
                return false;
            } else if (isNaN(cardPrice.value) || cardPrice.value <= 0 || parseFloat(cardPrice.value) % 1 != 0) {
                alert("礼品卡面值必须是大于0的整数!")
                cardPrice.focus();
                return false;
            } else if (isNaN(oBeforNumber.value) || oBeforNumber.value <= 0 || parseFloat(oBeforNumber.value) % 1 != 0) {
                alert("礼品卡前面数字必须是大于0的整数!")
                oBeforNumber.focus();
                return false;
            }

            else if (endTime.value == "") {
                alert("专区截止日期不能为空!");
                endTime.focus();
                return false;
            }
            else if (cardType.value == "") {
                alert("卡片类别不能为空!");
                cardType.focus();
                return false;
            }
            else if (cardCount.value == "") {
                alert("卡片数量不能为空!");
                cardCount.focus();
                return false;
            } else if (isNaN(cardCount.value) || cardCount.value <= 0 || parseFloat(cardCount.value) % 1 != 0) {
                alert("卡片数量必须是大于0的整数!")
                cardCount.focus();
                return false;
            }



        }
    </script>

    <style type="text/css">
        #company
        {
            width: 80px;
        }
    </style>

</head>
<body>
    <form id="form1" runat="server">
    <div>
 <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#F1F4F7">
<tr>
<td height="382" align="center" valign="top">
  <br />


      <table Width="98%" border="0" cellpadding="5" cellspacing="0">
       <tr>
          <td align="right" width="20%">礼品卡面值</td>
          <td><input name="cardprice" type="text" id="cardprice"  runat="server" value="0" style="width: 80px" /><br />即购买人需要花费的实际金额</td>
        </tr>

       <tr>
          <td align="right" width="20%">卡起始号</td>
          <td><input name="befornumber" type="text" id="befornumber"  runat="server" 
                  value="" style="width: 120px" maxlength="15" /> <br />
              </td>
        </tr>
        <tr>
          <td align="right">专区开始日期</td>
          <td><input name="txtSartTime" type="text" id="txtSartTime" 
                  style="behavior:url('../../LWDP2.HTC'); width: 80px;" runat="server" /></td>
        </tr>
        <tr>
          <td align="right">专区截止日期</td>
          <td><input name="endtime" type="text" id="endtime"  
                  style="behavior:url('../../LWDP.HTC'); width: 80px;" runat="server" /><br />购买人必须在此日期前使用，否则自动失效</td>
        </tr>
         <tr>
          <td align="right">发行方式</td>
          <td>
           <asp:DropDownList ID="ddlPublishWay" runat="server">
            <asp:ListItem Text="卡券" Value="卡券"></asp:ListItem>
             <asp:ListItem Text="电子券" Value="电子券"></asp:ListItem>
           </asp:DropDownList>
          </td>
        </tr>
    
     
        <tr>
          <td align="right">礼品卡类别</td>
          <td>
              <asp:DropDownList ID="ddlCardType" runat="server">
              </asp:DropDownList>
            </td>
        </tr>
     
         <tr>
          <td align="right">数量</td>
          <td>
          <input name="txtCardCount" type="text" id="txtCardCount"  runat="server" value="0" style="width: 80px" />
          </td>
        </tr>
        <tr>
          <td align="right">商家</td>
          <td>
              <asp:DropDownList ID="ddlCompany" runat="server">
              </asp:DropDownList>
            </td>
        </tr>
        <tr>
          <td align="right">&nbsp;</td>
          <td>

             <asp:ImageButton ID="btnGenerate"  OnClientClick="return checkForm();" ImageUrl="../images/btnGenerateCard.gif" runat="server" OnClick="ibtnGenerate_Click" />

            </td>
        </tr>
        <tr>
          <td align="center" colspan="2">
  <asp:GridView ID="GridView1" runat="server" Width="98%" CellPadding="4" ForeColor="#333333" 
                  AutoGenerateColumns="False" pagesize="100" BorderStyle="Solid" 
                  BorderWidth="1px" 
      ShowFooter="false" EmptyDataText="没有数据记录！！" >
        <Columns>
           <asp:BoundField HeaderText="卡 号" DataField="cardcode" />
               <asp:BoundField HeaderText="礼品卡类别" DataField="CardTypeName" />
        <asp:BoundField HeaderText="金 额" DataField="cardprice"  />
          <asp:TemplateField HeaderText="专区开始日期">
          <ItemStyle Width="100px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}",Eval("starttime"))%>
        </ItemTemplate>
           </asp:TemplateField>
        <asp:TemplateField HeaderText="专区截止日期">
        <ItemStyle Width="100px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}",Eval("endtime"))%>
        </ItemTemplate>
        </asp:TemplateField>
         <asp:TemplateField HeaderText="礼品商城截止日期">
        <ItemStyle Width="110px" />
        <ItemTemplate>
           <%# string.Format("{0:yyyy-MM-dd}", Eval("lasttime"))%>
        </ItemTemplate>
        </asp:TemplateField>
       
        </Columns>
             <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />             
             <PagerStyle BackColor="White" ForeColor="#333333" HorizontalAlign="Center" Font-Bold="True" Font-Size=30px />
             <HeaderStyle BackColor="#E2E7EB" Font-Bold="True" ForeColor="Black" HorizontalAlign="Left" />
             <AlternatingRowStyle BackColor="White" />
             <PagerSettings Visible="False" />
        </asp:GridView>
            </td>
        </tr>
      </table>
      
  <table Width="98%" border="0" cellpadding="5" cellspacing="0">
  <tr>
      <td align="center"  colspan="2" >

                   <asp:ImageButton ID="btnAdd"  Visible="false" ImageUrl="../images/btnGenerateCard.gif" runat="server" OnClick="ibtnAdd_Click" />

      &nbsp;
       <asp:ImageButton ID="btnExport"  Visible="false" ImageUrl="../images/btnExportExcel.gif" runat="server" OnClick="ibtnExport_Click" />

     
</td>
      </tr>
   </table>
  </td>
</tr>
</table>
    </div>
    </form>
</body>
</html>
